1. Field of the Invention
This invention relates to a method of encoding a video signal which includes a quantization step. This invention also relates to an apparatus for encoding a video signal which uses a quantization process.
2. Description of the Related Art
Japanese published unexamined patent application 7-284097 discloses an apparatus for encoding a video signal which uses a quantization process. The apparatus of Japanese application 7-284097 divides an input video signal into time segments corresponding to equal intervals respectively, and implements signal processing on an interval-by-interval basis.
In more detail, the apparatus of Japanese application 7-284097 has first and second paths along which a same input video signal is transmitted while being processed. A first encoding circuit in the first path encodes the video signal for every interval. The encoding by the first encoding circuit includes quantization using a fixed quantization width. Information of the amount D1 of encoding-resultant data generated by the first encoding circuit for every interval is stored into a memory circuit in the first path. The information of the data amount (the actual data amount) D1 is transmitted from the memory circuit to a target data amount setting circuit. The target data amount setting circuit determines a target data amount D2 for every interval on the basis of the actual data amount D1 by referring to the following equation.
D2=D1xc2x7DALL/xcexa3D1
where DALL denotes the total amount of data corresponding to the video signal, and xcexa3D1 denotes the summation of the actual data amounts D1 for all the intervals.
In the apparatus of Japanese application 7-284097, a second encoding circuit in the second path encodes the video signal for every interval. The encoding by the second encoding circuit includes quantization responsive to a variable quantization width. Generally, as the quantization width increases, the amount D3 of encoding-resultant data generated by the second encoding circuit for every interval decreases. A first total data amount detection circuit connected to the second encoding circuit is informed of the data amount (the actual data amount) D3. The first total data amount detection circuit calculates the summation xcexa3D3 of the data amounts (the actual data amounts) D3 for the intervals up to the present interval. A second total data amount detection circuit connected to the target data amount setting circuit is informed of the target data amount D2. The second total data amount detection circuit calculates the summation xcexa3D2 of the target data amounts D2 for the intervals up to the present interval.
In the apparatus of Japanese application 7-284097, a comparison circuit is informed of the target total data amount xcexa3D2 and the actual total data amount xcexa3D3 by the first and second total data amount detection circuits. The comparison circuit compares the total data amounts xcexa3D2 and xcexa3D3 with each other. The comparison circuit informs a target data amount correction circuit of the comparison result. The target data amount correction circuit corrects the target data amount D2 into a final target data amount in response to the comparison result. The final target data amount is reported to the second encoding circuit from the target data amount setting circuit. The quantization width used by the quantizer in the second encoding circuit is controlled in response to the final target data amount. Accordingly, the amount D3 of encoding-resultant data generated by the second encoding circuit for every interval depends on the final target data amount. The encoding-resultant data generated by the second encoding circuit is used as an apparatus output video signal.
In the apparatus of Japanese application 7-284097, the correction of the target data amount D2 by the target data amount correction circuit is designed to implement the following processes. In the case where the target total data amount xcexa3D2 is greater than the actual total data amount xcexa3D3, the target data amount D2 is corrected to slightly increase the final target data amount during intervals after the present interval. In the case where the target total data amount xcexa3D2 is smaller than the actual total data amount xcexa3D3, the target data amount D2 is corrected to slightly decrease the final target data amount during intervals after the present interval. Accordingly, the actual total data amount xcexa3D3 is regulated substantially at the target total data amount xcexa3D2.
In the apparatus of Japanese application 7-284097, during an interval after the interval for which the amount of data corresponding to the video signal is significantly great, the quantization width used by the second encoding circuit tends to be set to an unduly large value. On the other hand, during an interval after the interval for which the amount of data corresponding to the video signal is significantly small, the quantization width tends to be set to an unduly small value.
It is a first object of this invention to provide a method of encoding a video signal which can stably control a quantization width during intervals after the interval where the amount of data corresponding to the video signal is significantly great or small.
It is a second object of this invention to provide an apparatus for encoding a video signal which can stably control a quantization width during intervals after the interval where the amount of data corresponding to the video signal is significantly great or small.
A first aspect of this invention provides a method of encoding input picture data representing a succession of pictures each composed of plural blocks. The method comprises the steps of quantizing the input picture data into first quantization-resultant data in response to a fixed quantization width; encoding the first quantization-resultant data into first code data of a variable length code for every block; generating information of an accumulation transition in an amount of the first code data for every block; calculating a code amount accumulation transition value from the accumulation-transition information and a predetermined target code amount for every block, the predetermined target code amount being defined with respect to every picture; quantizing the input picture data into second quantization-resultant data in response to a variable quantization width; encoding the second quantization-resultant data into second code data of the variable length code for every block; detecting an actual amount of the second code data for every block; calculating an error between the code amount accumulation transition value and the detected actual amount of the second code data for every block; and controlling the variable quantization width in response to the calculated error for every block to maintain an actual amount of the second code data substantially at the target code amount for every picture.
A second aspect of this invention provides a method of encoding input picture data representing a succession of frames each divided into plural frame portions. Each of the frame portions is composed of blocks. The method comprises the steps of dividing the input picture data into first division-resultant picture data portions corresponding to the respective frame portions; quantizing the first division-resultant picture data portions into first quantization-resultant data portions in response to a fixed quantization width in parallel; encoding the first quantization-resultant data portions into first code data portions of a variable length code in parallel for every block; generating information of an accumulation transition in an amount of each of the first code data portions for every block; calculating a code amount accumulation transition value from the accumulation-transition information and a predetermined target code amount for every block, the predetermined target code amount being defined with respect to every picture; dividing the input picture data into second division-resultant picture data portions corresponding to the respective frame portions; quantizing the second division-resultant picture data portions into second quantization-resultant data portions in response to variable quantization widths in parallel; encoding the second quantization-resultant data portions into second code data portions of the variable length code in parallel for every block; detecting an actual amount of each of the second code data portions for every block; calculating errors between the code amount accumulation transition value and the detected actual amounts of the second code data portions for every block; and controlling the variable quantization widths in response to the calculated errors for every block to maintain an actual amount of the second code data portions substantially at the target code amount for every picture.
A third aspect of this invention provides a method of encoding first input picture data representing a succession of pictures each composed of plural blocks. The method comprises the steps of quantizing the first input picture data into first quantization-resultant data in response to a fixed quantization width; encoding the first quantization-resultant data into first code data of a variable length code for every block; generating information of an accumulation transition in an amount of the first code data for every block; calculating a code amount accumulation transition value from the accumulation-transition information and a predetermined target code amount for every block, the predetermined target code amount being defined with respect to every picture; delaying the first input picture data into second input picture data by a predetermined time interval corresponding to a given number of successive pictures; quantizing the second input picture data into second quantization-resultant data in response to a variable quantization width; encoding the second quantization-resultant data into second code data of the variable length code for every block; detecting an actual amount of the second code data for every block; calculating an error between the code amount accumulation transition value and the detected actual amount of the second code data for every block; and controlling the variable quantization width in response to the calculated error for every block to maintain an actual amount of the second code data substantially at the target code amount for every picture.
A fourth aspect of this invention is based on the first aspect thereof, and provides a method wherein the accumulation-transition information results from normalization with an amount of the first code data for every picture, and includes data of a difference between amounts of the first code data for two successive bocks, and wherein the code amount accumulation transition value is equal to the target code amount multiplied by a value resulting from normalizing a sum of the differences for blocks up to a last processed block with the amount of the first code data for every picture.
A fifth aspect of this invention provides an apparatus for encoding input picture data representing a succession of pictures each composed of plural blocks. The apparatus comprises means for quantizing the input picture data into first quantization-resultant data in response to a fixed quantization width; means for encoding the first quantization-resultant data into first code data of a variable length code for every block; means for generating information of an accumulation transition in an amount of the first code data for every block; means for calculating a code amount accumulation transition value from the accumulation-transition information and a predetermined target code amount for every block, the predetermined target code amount being defined with respect to every picture; means for quantizing the input picture data into second quantization-resultant data in response to a variable quantization width; means for encoding the second quantization-resultant data into second code data of the variable length code for every block; means for detecting an actual amount of the second code data for every block; means for calculating an error between the code amount accumulation transition value and the detected actual amount of the second code data for every block; and means for controlling the variable quantization width in response to the calculated error for every block to maintain an actual amount of the second code data substantially at the target code amount for every picture.
A sixth aspect of this invention provides an apparatus for encoding input picture data representing a succession of frames each divided into plural frame portions. Each of the frame portions is composed of blocks. The apparatus comprises means for dividing the input picture data into first division-resultant picture data portions corresponding to the respective frame portions; means for quantizing the first division-resultant picture data portions into first quantization-resultant data portions in response to a fixed quantization width in parallel; means for encoding the first quantization-resultant data portions into first code data portions of a variable length code in parallel for every block; means for generating information of an accumulation transition in an amount of each of the first code data portions for every block; means for calculating a code amount accumulation transition value from the accumulation-transition information and a predetermined target code amount for every block, the predetermined target code amount being defined with respect to every picture; means for dividing the input picture data into second division-resultant picture data portions corresponding to the respective frame portions; means for quantizing the second division-resultant picture data portions into second quantization-resultant data portions in response to variable quantization widths in parallel; means for encoding the second quantization-resultant data portions into second code data portions of the variable length code in parallel for every block; means for detecting an actual amount of each of the second code data portions for every block; means for calculating errors between the code amount accumulation transition value and the detected actual amounts of the second code data portions for every block; and means for controlling the variable quantization widths in response to the calculated errors for every block to maintain an actual amount of the second code data portions substantially at the target code amount for every picture.
A seventh aspect of this invention provides an apparatus for encoding first input picture data representing a succession of pictures each composed of plural blocks. The apparatus comprises means for quantizing the first input picture data into first quantization-resultant data in response to a fixed quantization width; means for encoding the first quantization-resultant data into first code data of a variable length code for every block; means for generating information of an accumulation transition in an amount of the first code data for every block; means for calculating a code amount accumulation transition value from the accumulation-transition information and a predetermined target code amount for every block, the predetermined target code amount being defined with respect to every picture; means for delaying the first input picture data into second input picture data by a predetermined time interval corresponding to a given number of successive pictures; means for quantizing the second input picture data into second quantization-resultant data in response to a variable quantization width; means for encoding the second quantization-resultant data into second code data of the variable length code for every block; means for detecting an actual amount of the second code data for every block; means for calculating an error between the code amount accumulation transition value and the detected actual amount of the second code data for every block; and means for controlling the variable quantization width in response to the calculated error for every block to maintain an actual amount of the second code data substantially at the target code amount for every picture.
An eighth aspect of this invention provides an apparatus for encoding first input picture data representing a succession of pictures each composed of plural blocks. The apparatus comprises means for detecting an activity of the first input picture data for every block; means for generating information of an accumulation transition in an amount of the first code data in response to the detected activity for every block; means for calculating a code amount accumulation transition value from the accumulation-transition information and a predetermined target code amount for every block, the predetermined target code amount being defined with respect to every picture; means for delaying the first input picture data into second input picture data by a predetermined time interval corresponding to a given number of successive pictures; means for quantizing the second input picture data into second quantization-resultant data in response to a variable quantization width; means for encoding the second quantization-resultant data into second code data of the variable length code for every block; means for detecting an actual amount of the second code data for every block; means for calculating an error between the code amount accumulation transition value and the detected actual amount of the second code data for every block; and means for controlling the variable quantization width in response to the calculated error for every block to maintain an actual amount of the second code data substantially at the target code amount for every picture.
A ninth aspect of this invention is based on the fifth aspect thereof, and provides an apparatus wherein the accumulation-transition information results from normalization with an amount of the first code data for every picture, and includes data of a difference between amounts of the first code data for two successive bocks, and wherein the code amount accumulation transition value is equal to the target code amount multiplied by a value resulting from normalizing a sum of the differences for blocks up to a last processed block with the amount of the first code data for every picture.